// 用户store

import { defineStore } from "pinia";
import { ref } from "vue";

export const useUserStore = defineStore(
  "user",
  () => {
    const user = ref<TUser | null>(null);

    const handleSetUser = (val: TUser) => {
      user.value = val;
    };
    return { user, handleSetUser };
  },
  {
    persist: {
      storage: sessionStorage, // 可以设置为sessionStorage存储
    }, // 数据持久化
  }
);
